#ifndef __SSTRING_H__
#define __SSTRING_H__

#include<iostream>
#include<cstdlib>
#define MAXSIZE 100

using namespace std;

template<typename T, size_t N>
unsigned char(& dimension_help_fun(T(&ts)[N]))[N];
#define DIM(a) (sizeof(dimension_help_fun(a)))

typedef enum{
    FAIL, SUCCESS
}Status;
typedef char Elemtype;
typedef struct{
    Elemtype data[MAXSIZE];
    int length;
}SString;

Status InitSString(SString *&s);
Status CreateSString(SString *&s, Elemtype a[], int n);
void destroySString(SString *&s);
void DisplaySString(SString *s);

//B-F
int index(SString *S, SString *T);

//KMP
void GetNext(SString *T, int next[]);
int KMPIndex(SString *S, SString *T);

#endif
